﻿import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { BooksComponent } from './books/books.component';
import { KehusComponent } from './kehus/kehus.component';
import { ExcelTestComponent } from './shared/services/excel-test.component';
import { VehicleComponent } from './Vehicle/vehicle.component';
import { ADManagementComponent } from './admanagement/admanagement.component';
import { OrdersComponent } from './orders/orders.component';
import { FleetcarComponent } from './fleetcar/fleetcar.component';
import { OtherWarehousingComponent } from './purchase/otherwarehousing/other-warehousing.component';
import { NotificationOrderComponent } from './purchase/notificationorder/notification-order.component';
import { GongyingsComponent } from './gongyings/gongyings.component';
import { ReceiptOrderComponent } from './purchase/receiptOrder/receipt-order.component';
import { CarInventryComponent } from './carInventry/carinventry.component';
import { InventoryTransferComponent } from './inventoryTransfer/inventory-transfer.component';
import { KucunZhuXinxiComponent } from './stock/kucun-zhu-xinxi/kucun-zhu-xinxi.component';
import { ChuRuKuLiuShuiComponent } from './stock/chu-ru-ku-liu-shui/chu-ru-ku-liu-shui.component';
import { BaoZhiQiChaXunComponent } from './stock/bao-zhi-qi-cha-xun/bao-zhi-qi-cha-xun.component';
import { PiCiChaXunComponent } from './stock/pi-ci-cha-xun/pi-ci-cha-xun.component';
import { KuCunYuJingComponent } from './stock/ku-cun-yu-jing/ku-cun-yu-jing.component';
import { TestNavigationComponent } from './test-navigation/test-navigation.component';
import { InventoryTransferDetailComponent } from './inventoryTransfer/inventory-transfer-detail.component';
import { OutOrderComponent } from './OutOrder/out-order.component';
import { AllocationComponent } from './allocation/allocation.component';
import { AllocationAddComponent } from './allocation/allocation-add.component';


const routes: Routes = [
  {
    path: '',
    loadChildren: () => import('./home/home.module').then(m => m.HomeModule)
  },
  {
    path: 'test',
    component: TestNavigationComponent
  },
  {
    path: 'storage',
    loadChildren: () => import('./storage/storage.module').then(m => m.StorageModule)
  },
  {
    path: 'purchase/customergoods',
    loadChildren: () => import('./purchase/customergoods/customer-good.module').then(m => m.CustomerGoodModule)
  },
  {
    path: 'purchase',
    children: [
      {
        path: 'otherwarehousing',
        component: OtherWarehousingComponent
      },
      {
        path: 'notification-order',
        component: NotificationOrderComponent,
        data: {
          requiredPolicy: 'Purchase.NotificationOrder'
        }
      },
      {
        path: 'receipt-order',
        component: ReceiptOrderComponent,
        data: {
          requiredPolicy: 'Purchase.ReceiptOrder'
        }
      }
    ]
  },
  {
    path: 'books',
    component: BooksComponent
  },
  {
    path: 'kehus',
    component: KehusComponent
  },
  {
    path: 'gongyings', // 供应商路由
    component: GongyingsComponent
  },
  /*{
    path: 'purchase/customergoods',
    loadComponent: () => import('./purchase/customergoods/customer-goods.component').then(m => m.CustomerGoodsComponent)
  },*/
  {
    path: 'excel-test',
    component: ExcelTestComponent
  },
  {
    path: 'vehicle',
    component: VehicleComponent
  },
  {
    path: 'admanagement',
    component: ADManagementComponent
  },
  {
    path: 'orders',
    component: OrdersComponent
  },
  {
    path: 'fleetcar',
    component: FleetcarComponent
  },
  {
    path: 'carinventry',
    component: CarInventryComponent
  },
  {
    path: 'shops',
    loadComponent: () => import('./shops/shops.component').then(m => m.ShopsComponent)
  },
  {
    path: 'rfids',
    loadComponent: () => import('./rfids/rfids.component').then(m => m.RfidsComponent)
  },
  {
    path: 'products',
    loadChildren: () => import('./products/product.module').then(m => m.ProductModule)
  },
  {
    path: 'inventoryTransfer',
    component: InventoryTransferComponent
  },
  {
    path: 'allocation/add',
    component: AllocationAddComponent
  },
  {
    path: 'allocation',
    component: AllocationComponent
  },
  
  {
    path: 'dashboard',
    loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule)
  },
  // 添加对stock/kucun-zhu-xinxi的支持
  {
    path: 'stock/kucun-zhu-xinxi',
    component: KucunZhuXinxiComponent,
    data: {
      requiredPolicy: 'Stock.KucunZhuXinxi'
    }
  },
  // 保留原有路由，实现双路径支持
  {
    path: 'kucun-zhu-xinxi',
    component: KucunZhuXinxiComponent,
    data: {
      requiredPolicy: 'Stock.KucunZhuXinxi'
    }
  },
  // 添加对stock/chu-ru-ku-liu-shui的支持
  {
    path: 'stock/chu-ru-ku-liu-shui',
    component: ChuRuKuLiuShuiComponent,
    data: {
      requiredPolicy: 'Stock.ChuRuKuLiuShui'
    }
  },
  {
    path: 'chu-ru-ku-liu-shui',
    component: ChuRuKuLiuShuiComponent,
    data: {
      requiredPolicy: 'Stock.ChuRuKuLiuShui'
    }
  },
  {
    path: 'stock/bao-zhi-qi-cha-xun',
    component: BaoZhiQiChaXunComponent,
    data: {
      requiredPolicy: 'Stock.BaoZhiQiChaXun'
    }
  },
  {
    path: 'bao-zhi-qi-cha-xun',
    component: BaoZhiQiChaXunComponent,
    data: {
      requiredPolicy: 'Stock.BaoZhiQiChaXun'
    }
  },
  {
    path: 'stock/pi-ci-cha-xun',
    component: PiCiChaXunComponent,
    data: {
      requiredPolicy: 'Stock.PiCiChaXun'
    }
  },
  {
    path: 'pi-ci-cha-xun',
    component: PiCiChaXunComponent,
    data: {
      requiredPolicy: 'Stock.PiCiChaXun'
    }
  },
  // 添加库存预警路由
  {
    path: 'stock/ku-cun-yu-jing',
    component: KuCunYuJingComponent,
    data: {
      requiredPolicy: 'Stock.KuCunYuJing'
    }
  },
  {
    path: 'ku-cun-yu-jing',
    component: KuCunYuJingComponent,
    data: {
      requiredPolicy: 'Stock.KuCunYuJing'
    }
  },
  {
    path: 'inventoryTransfer/detail/:id',
    component: InventoryTransferDetailComponent
  },
  {
    path: 'storehouse',
    loadComponent: () => import('./FormWhx/storehouse/storehouse.component').then(m => m.StorehouseComponent),
    data: {
      requiredPolicy: 'Default.Storehouse'
    }
  },
  {
    path: 'out-order',
    loadChildren: () => import('./OutOrder/out-order.module').then(m => m.OutOrderModule)
  },
  {
    path: 'account',
    loadChildren: () => import('@abp/ng.account').then(m => m.AccountModule.forLazy()),
  },
  {
    path: 'identity',
    loadChildren: () => import('@abp/ng.identity').then(m => m.IdentityModule.forLazy()),
  },
  {
    path: 'tenant-management',
    loadChildren: () =>
      import('@abp/ng.tenant-management').then(m => m.TenantManagementModule.forLazy()),
  },
  {
    path: 'setting-management',
    loadChildren: () =>
      import('@abp/ng.setting-management').then(m => m.SettingManagementModule.forLazy()),
  },
  /*{
    path: 'storage',
    loadChildren: () => import('./storage/storage.module').then(m => m.StorageModule),
  }*/
];

@NgModule({
  imports: [RouterModule.forRoot(routes, { useHash: true })],
  exports: [RouterModule],
})
export class AppRoutingModule {}
